﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LogicUniversityBiz
{
     public class RequisitionController
    {

         private CoreClerkFascade fascade = new CoreClerkFascade();
        public List<Requisition> getRequisitionList(DateTime approvedDate)
        {

            return fascade.getApprovedRequistionByDate(approvedDate);
        }

        public Department getDepartmentByID(string dept_code)
        {
            return fascade.getDepartment(dept_code);
        }
        public List<RequisitionCustom> getCurrentRequisition(string dept_Code, DateTime dateBefore)
        {
            return fascade.getCurrentRequisition(dept_Code, dateBefore);
        }
        public List<RequisitionCustom> getOutStanding(string dept_Code)
        {
            return fascade.getOutStanding(dept_Code);
        }
        public List<RequisitionCustom> getRequisitionToAdd(string dept_Code, DateTime dateBefore)
        {
            return fascade.getRequisitionToAdd(dept_Code, dateBefore);
        }
        public bool updateAndInsertReterival(string dept_Code, DateTime dateBefore,List<RequisitionCustom> req)
        {
            //foreach (RequisitionCustom r in req)
            //{
            //    if (r.Actual_Quanty > r.Needed || r.Actual_Quanty < 0)
            //    {
            //        r.Actual_Quanty = 0;
            //    }
            //}
            return fascade.updateAndInsertReterival(dept_Code, dateBefore,req);
        }
    }
}
